package time;

public class Time {

	public static void main(String[] args) {
		//isEmail();
		String regex = "[0-9_]+-[0-9_]+";
		String time = "07-00";
		boolean match = time.matches(regex);
		if(match) {
			System.out.println("是时间");
		}else{
			System.out.println("不是时间");
		}
	}

	private static void isEmail() {
		/*
		 *   邮箱地址
		 *   [a-zA-Z0-9_]+@[a-zA-Z0-9_]+(\.[a-zA-Z0-9]+)+
		 */
		String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9]+)+";

		String mail = "fancq@chenfang.com.cn";

		/*
		 * boolean matches(String regex)
		 * 使用给定的正则表达式验证当前字符串是否满足
		 * 格式要求，满足返回true
		 */
		boolean match = mail.matches(regex);
		if(match) {
			System.out.println("是邮箱");
		}else{
			System.out.println("不是邮箱");
		}
	}

}
